/**
 * @brief 调光灯设备
 */
#pragma once
#include "LightOnOff.h"

class LightDimmer : public LightOnOff
{
public:
    static constexpr uint16_t kDeviceTypeDimmableLight = 0x0101;
    explicit LightDimmer(const BasicInformation* node);

    void SetLevel(uint8_t level);
    void UpdateLevel(uint8_t level);
    [[nodiscard]] uint8_t GetLevel() const;

    Protocols::InteractionModel::Status ReadAttribute(
        ClusterId clusterId,
        AttributeId attributeId,
        uint8_t* buffer,
        uint16_t maxReadLength) override;

    Protocols::InteractionModel::Status WriteAttribute(
        ClusterId clusterId,
        const EmberAfAttributeMetadata* attributeMetadata,
        uint8_t* buffer) override;

    ChipError OnReport(const DataBlock* block) override;
    ChipError OnReadAttributes() override;

    ChipError  AttachToIndex(uint16_t index) override;

private:
    uint8_t mLevel;
};

